﻿using MathTutorPro.Data.Entities;
using MathTutorPro.Models.Requests;
using MathTutorPro.Models.Responses;

namespace MathTutorPro.Services.Interfaces
{
    /// <summary>
    /// 群组聊天服务接口
    /// </summary>
    public interface IGroupChatService
    {
        /// <summary>
        /// 创建群组
        /// </summary>
        /// <param name="userId">创建者ID</param>
        /// <param name="request">创建群组请求</param>
        /// <returns>创建的群组ID</returns>
        Task<int> CreateGroupAsync(string userId, GroupCreateRequest request);

        /// <summary>
        /// 获取用户的群组列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>群组列表</returns>
        Task<IEnumerable<GroupResponse>> GetUserGroupsAsync(string userId);

        /// <summary>
        /// 获取群组消息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="groupId">群组ID</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">每页大小</param>
        /// <returns>消息列表</returns>
        Task<IEnumerable<MessageResponse>> GetGroupMessagesAsync(string userId, int groupId, int page = 1, int pageSize = 20);

        /// <summary>
        /// 获取群组详情
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="groupId">群组ID</param>
        /// <returns>群组详情</returns>
        Task<GroupDetailResponse> GetGroupDetailAsync(string userId, int groupId);

        /// <summary>
        /// 加入群组
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="groupId">群组ID</param>
        Task JoinGroupAsync(string userId, int groupId);

        /// <summary>
        /// 退出群组
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="groupId">群组ID</param>
        Task LeaveGroupAsync(string userId, int groupId);

        /// <summary>
        /// 获取群组成员
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="groupId">群组ID</param>
        /// <returns>成员列表</returns>
        Task<IEnumerable<GroupMemberResponse>> GetGroupMembersAsync(string userId, int groupId);

        /// <summary>
        /// 添加群组成员
        /// </summary>
        /// <param name="userId">操作用户ID</param>
        /// <param name="groupId">群组ID</param>
        /// <param name="memberIds">要添加的成员ID列表</param>
        Task AddGroupMembersAsync(string userId, int groupId, List<string> memberIds);

        /// <summary>
        /// 移除群组成员
        /// </summary>
        /// <param name="userId">操作用户ID</param>
        /// <param name="groupId">群组ID</param>
        /// <param name="memberId">要移除的成员ID</param>
        Task RemoveGroupMemberAsync(string userId, int groupId, string memberId);

        /// <summary>
        /// 发送群组消息
        /// </summary>
        /// <param name="groupId">群组ID</param>
        /// <param name="senderId">发送者ID</param>
        /// <param name="content">消息内容</param>
        Task SendMessageAsync(int groupId, string senderId, string content);
    }
}
